<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
    <title>分类管理</title>
    <link rel="stylesheet" type="text/css" href="http://localhost/e-shop/xiangqu/Static/hdjs/hdjs.css">
    <script type="text/javascript" charset="utf-8" src="http://localhost/e-shop/xiangqu/Static/ueditor1_4_3/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="http://localhost/e-shop/xiangqu/Static/ueditor1_4_3/ueditor.all.min.js"> </script>
	<script type="text/javascript" charset="utf-8" src="http://localhost/e-shop/xiangqu/Static/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="http://localhost/e-shop/xiangqu/Static/uploadify/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="http://localhost/e-shop/xiangqu/Static/uploadify/jquery.uploadify.min.js"></script>
	<link href="http://localhost/e-shop/xiangqu/Static/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
	<style type="text/css">
		#detail,#server{
			margin: 0 auto;
		}
		#photo-list li,#photo-list2 li{
			list-style: none;
			float: left;
			margin-right: 20px;
		}
		.adds{
			/*padding-right: 50px;*/
		}
		.wrap select{
			width: 220px;
			height: 30px;
		}
		.wrap .path{
			width: 300px;
			height: 30px;
		}
		
	</style>
	<script type="text/javascript">
		$(function(){
			
			
			//处理****删除图片
			$('.del-img').live('click',function(){
				var li = $(this).parents('li');
				var path = li.attr('path');
				$.ajax({
					type:"post",
					url:"<?php echo U('delImg');?>",
					data:{path:path},
					success:function(data){
						li.remove();
					}
					
				})
			})
			
		})
		
		
		
	</script>
</head>
<body>
<div class="wrap">
    <div class="hd-title-header">添加轮播图</div>
    <form action="" method="post" class="form-inline hd-form" enctype="multipart/form-data" >
		<table class='hd-table hd-table-form hd-table-list'>
			<tr>
				<td>轮播图路径</td>
				<td><input type="text" name="path" class="path" /></td>
				<td></td>
			</tr>
			<tr>
				<td>是否显示</td>
				<td height="30px">
					是：<input type="radio" name="is_show" value="0" checked="checked" style="margin-right:50px" />
					否：<input type="radio" name="is_show" value="1" />
				</td>
				<td></td>
			</tr>
			<tr class="info">
				<td width="100" height="100">上传图片</td>
				<td width="400">
			<input id="pic" type="file" multiple="true" name="thumb">
            <span>类型: *.jpg,*.png 大小: 2000KB</span>
            <script type="text/javascript">
                $(function() {
                    $('#pic').uploadify({
                        'formData'     : {//POST数据
                            '<?php echo session_name();?>' : '<?php echo session_id();?>',
                        },
                        'fileTypeDesc' : '上传文件',//上传描述
                        'fileTypeExts' : '*.jpg;*.png',
                        'swf'      : 'http://localhost/e-shop/xiangqu/Static/uploadify/uploadify.swf',
                        'uploader' : '<?php echo U("upload");?>',//执行控制器上的上传类
                        'buttonText':'选择文件',
                        'fileSizeLimit' : '2000KB',
                        'uploadLimit' : 1000,//上传文件数
                        'width':65,
                        'height':40,
                        'successTimeout':10,//等待服务器响应时间
                        'removeTimeout' : 0.2,//成功显示时间
                        'onUploadSuccess' : function(file, data, response) {
                            data=$.parseJSON(data);
                            var imageUrl = data.image?data.url:'http://localhost/e-shop/xiangqu/Static/image/default.png';
                            var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' style='width:200px;height:100px'/><a href='javascript:;' style='color:red' class='del-img'>X</a><input type='hidden' name='picture' value='"+data.path+"'></li>";
                            $("#photo-list2").append(li);
                        }
                    });
                });
            </script>
				</td>
				<td id='photo-list2'></td>
			</tr>
		</table>
		

        <div class="position-bottom">
            <input type="submit" class="hd-btn hd-btn-success" value="添加"/>
        </div>
    </form>
</div>
</body>
</html>